<%-- 
    Document   : cmteditor
    Created on : Nov 20, 2012, 8:07:28 AM
    Author     : Psy Fox
--%>

<%@page import="tracker.entity.TorrentsEntity"%>
<%@page import="tracker.stub.TorrentsSessionStub"%>
<%@page import="tracker.stub.UsersSessionStub"%>
<%@page import="tracker.entity.UsersEntity"%>
<%@page import="tracker.entity.CommentsEntity"%>
<%@page import="tracker.stub.CommentsSessionStub"%>
<%@page language="java" contentType="text/html" pageEncoding="UTF-8"%>
<%
    UsersSessionStub stub = new UsersSessionStub();
    int userid = Integer.valueOf(request.getParameter("userid"));
    int torrentid = Integer.valueOf(request.getParameter("torrentid"));
    UsersEntity user = stub.findUserById(userid);
    TorrentsSessionStub trstub = new TorrentsSessionStub();
    TorrentsEntity torrent = trstub.findUserById(torrentid);
    CommentsSessionStub cmstub = new CommentsSessionStub();
    CommentsEntity comment = new CommentsEntity();
    comment.setCommentId(0);
    comment.setUserId(user);
    comment.setTorrentId(torrent);
    comment.setCommentContent(request.getParameter("comment"));
    cmstub.insert(comment);

%>
<li class="box">

    <a href="user/singleUser.jsp?userId=<%= userid%>"><h4><%= user.getUserName()%></h4></a>
    <p><%= request.getParameter("comment")%></p>
</li>
